<template>
  <!-- 开户单位全面流动性查询结果明细页面弹出框-->
  <el-dialog
    title="开户单位全面流动性查询结果明细"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="true"
    @close="closeFn"
  >
    <el-form ref="detailsForm" :model="formData" label-width="180px" :disabled="true">
      <el-card class="form-card txnInfo-card">
        <div slot="header" class="label-header-msg">
          <span>基本信息</span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="交易流水号：" prop="id">
              <el-input v-model="formData.id" placeholder="交易流水号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报文标识号：" prop="pkgId">
              <el-input v-model="formData.pkgId" placeholder="报文标识号" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="CPG日期：" prop="vdate">
              <el-date-picker
                v-model="formData.vdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工作日期：" prop="workdate">
              <el-date-picker
                v-model="formData.workdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="被查询清算行行号：" prop="inqStBrno">
              <el-input v-model="formData.inqStBrno" placeholder="被查询清算行行号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="被查询清算行行名：" prop="inqStBrname">
              <el-input v-model="formData.inqStBrname" placeholder="被查询清算行行名" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="查询方式：" prop="inqType">
              <el-select v-model="formData.inqType" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.QUERYACCOUNTCODE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="通讯状态：" prop="status">
              <el-select v-model="formData.status" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.PKG_STATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="报文发送时间：" prop="sndTime">
              <el-date-picker
                v-model="formData.sndTime"
                type="datetime"
                value-format="yyyyMMddHHmmss"
                placeholder="选择时间"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="备注：" prop="remarks">
              <el-input type="textarea" v-model="formData.remarks" placeholder="备注" maxlength="256" show-word-limit />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <!-- 开户单位全面流动性应答信息 -->
      <el-card class="form-card txnInfo-card">
        <div slot="header" class="label-header-msg">
          <span>开户单位全面流动性应答信息</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="中心状态：" prop="procstatus">
              <el-select v-model="formData.procstatus" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.PROCESSSTATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="业务处理码：" prop="procCode">
              <el-select v-model="formData.procCode" placeholder="请选择" style="width: 100%">
                <el-option
                  :key="formData.procCode"
                  :label="`${formData.procCode}-${formData.procCodeDesc}`"
                  :value="formData.procCode"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="拒绝业务的参与机构行号：" prop="rejectBrno">
              <el-input v-model="formData.rejectBrno" placeholder="拒绝业务的参与机构行号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="拒绝业务的参与机构行名：" prop="rejectBrname">
              <el-input v-model="formData.rejectBrname" placeholder="拒绝业务的参与机构行名" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="参与机构业务拒绝码：" prop="orgRejectCode">
              <el-select v-model="formData.orgRejectCode" placeholder="请选择" style="width: 100%">
                <el-option
                  :key="formData.orgRejectCode"
                  :label="`${formData.orgRejectCode ? formData.orgRejectCode : ''}${formData.orgRejectCodeDesc ? '-' + formData.orgRejectCodeDesc : ''}`"
                  :value="formData.orgRejectCode"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="处理日期（终态日期）：" prop="procDate">
              <el-date-picker
                v-model="formData.procDate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="业务拒绝信息：" prop="rejectInfo">
              <el-input
                type="textarea"
                v-model="formData.rejectInfo"
                placeholder="业务拒绝信息"
                maxlength="128"
                show-word-limit
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="清算账户和非清算账户合计数：" prop="totalAct">
              <el-input v-model="formData.totalAct" placeholder="清算账户和非清算账户合计数" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="清算账户数：" prop="stActNum">
              <el-input v-model="formData.stActNum" placeholder="清算账户数" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="全面流动性汇总余额：" prop="totalBalance">
              <el-input v-model="formData.totalBalance" placeholder="全面流动性汇总余额" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="全面流动性汇总可用头寸：" prop="totalCuramt">
              <el-input v-model="formData.totalCuramt" placeholder="全面流动性汇总可用头寸" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="全面流动性汇总预期头寸：" prop="totalXpctdamt">
              <el-input v-model="formData.totalXpctdamt" placeholder="全面流动性汇总预期头寸" />
            </el-form-item>
          </el-col>
          <el-col :span="12"></el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="交易币种：" prop="curcd1" style="display: none">
              <el-input v-model="formData.curcd1" placeholder="交易币种" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="清算账户流动性汇总余额：" prop="stBalance">
              <el-input v-model="formData.stBalance" placeholder="清算账户流动性汇总余额" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="清算账户可用头寸：" prop="stCuramt">
              <el-input v-model="formData.stCuramt" placeholder="清算账户可用头寸" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="清算账户预期头寸：" prop="stXpctdamt">
              <el-input v-model="formData.stXpctdamt" placeholder="清算账户预期头寸" />
            </el-form-item>
          </el-col>
          <el-col :span="12"></el-col>
        </el-row>
      </el-card>
    </el-form>
    <div style="height: 300px">
      <ht-table
        ref="flowTable"
        :showSerialNumber="false"
        :multi-select="false"
        :dictMap="dictMap"
        :reqConfig="reqConfig"
        :queryParams="queryParams"
        :tableBindColumns="tableBindColumns"
        :opButtonList="opButtonList"
        :randomRowKey="true"
        :initData="false"
        defaultEventKey="flowTable"
        style="height: 100%"
      >
        <template v-slot:operate>
          <el-table-column label="操作" align="center" width="120" fixed="right" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <ht-button-group
                :buttonList="[
                  {
                    label: '明细',
                    // permission: 'user:xxx:xxx',
                    doFunc: () => {
                      handleAction('detailsInfo', scope.row);
                    },
                  },
                ]"
              />
            </template>
          </el-table-column>
        </template>
      </ht-table>
    </div>

    <!-- 明细操作弹出框 -->
    <ost-info ref="ostInfoDialog" :dictMap="dictMap" :detailsData="detailsData" :formData="formData"></ost-info>
  </el-dialog>
</template>
<script>
import { detailTabsearch } from "@/api/cnaps/saps/clearAcctBalance/open_qry_result.js";
import OstInfo from "./ostInfo";
export default {
  name: "QueryDetails",
  components: {
    OstInfo,
  },
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    formData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      detailsData: null, // 明细操作传值
      // 是否显示弹出层
      open: false,
      reqConfig: detailTabsearch,
      // 查询参数
      queryParams: {
        answerId: "",
      },
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        {
          label: `交易流水号`,
          prop: "Saps369ListId",
          width: "200",
          sortable: false,
        },
        {
          label: `清算账户行号`,
          prop: "stBrno",
          width: "200",
          sortable: false,
        },

        {
          label: `清算账户户名`,
          prop: "stActName",
          width: "200",
          sortable: false,
        },
        {
          label: `清算账户余额`,
          prop: "stActBalance",
          width: "100",
          sortable: false,
        },
        {
          label: `清算账户可用头寸`,
          prop: "cstCuramt",
          width: "150",
          sortable: false,
        },
        {
          label: `清算账户预期头寸`,
          prop: "cstXpctdamt",
          width: "150",
          sortable: false,
        },
        {
          label: `排队借记总金额`,
          prop: "dbtamt",
          width: "120",
          sortable: false,
        },
        {
          label: `排队贷记总金额`,
          prop: "cdtamt",
          sortable: false,
          width: "120",
        },

        {
          label: `所辖非清算账户数`,
          prop: "nStActNum",
          width: "120",
          sortable: false,
        },
        {
          label: `所辖非清算账户流动性汇总余额`,
          prop: "nStActBalance",
          width: "200",
          sortable: false,
        },
      ],
    };
  },
  mounted() {},
  watch: {
    open(d) {
      if (d) {

      }
    },
  },
  methods: {
    // 表单重置
    reset() {
      this.resetForm("detailsForm");
      // this.$set(this, "form", {});
    },
    closeFn() {
      this.open = false;
      this.reset();
    },
    show() {
      this.$nextTick(() => {
        if (this.formData && this.formData.answerId) {
          this.$set(this.queryParams, "answerId", this.formData.answerId);
          this.$refs.flowTable.doQuery();
        } else {
          this.$refs.flowTable.dataList = [];
        }
      });
      this.open = true;
    },
    handleAction(type, row = {}) {
      switch (type) {
        case "detailsInfo":
          // 设置
          this.detailsData = _.clone(row);
          this.$refs.ostInfoDialog.show();
          break;
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
